package cn.edu.xaut.mybatisers.mall.Controller;

import cn.edu.xaut.mybatisers.mall.Entity.AReturnDataStruct;
import cn.edu.xaut.mybatisers.mall.Entity.Consumer;
import cn.edu.xaut.mybatisers.mall.ServiceImp.ConsumerServiceImp;
import cn.edu.xaut.mybatisers.mall.tool.AReturnStructFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.sql.SQLException;

@Controller
public class ConsumerController {
    @Autowired
    ConsumerServiceImp consumerServiceImp;

    @ApiOperation("获得用户信息")
    @RequestMapping("/getUserInfo")
    @ResponseBody
    public AReturnDataStruct getUserInfo(HttpSession session) throws SQLException {
        Consumer consumerInfo = consumerServiceImp.getUserInfo(session);
        return AReturnStructFactory.returnDataStructFactory(true, "查询成功", 200, consumerInfo);
    }
}
